<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('出库单据历史列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>仓库：</label>
                                <select id="warehouseId" name="warehouseId" style="width: 200px" >
                                    <option value="01">托盘库</option>
                                    <option value="02">料箱库</option>
                                </select>
                            </li>
<!--                            <li>-->
<!--                                <label>子表ID：</label>-->
<!--                                <input type="text" name="stockoutDetailId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>主表ID：</label>-->
<!--                                <input type="text" name="stockoutId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>建单人：</label>-->
<!--                                <input type="text" name="createManId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>创建时间：</label>-->
<!--                                <input type="text" name="createDate"/>-->
<!--                            </li>-->
                            <li>
                                <label>单据来源：</label>
                                <input type="text" name="stockoutSource"/>
                            </li>
                            <li>
                                <label>下发订单号：</label>
                                <input type="text" name="FID"/>
                            </li>
<!--                            <li>-->
<!--                                <label>优先级：</label>-->
<!--                                <input type="text" name="carNumber"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>批号：</label>-->
<!--                                <input type="text" name="lotNo"/>-->
<!--                            </li>-->
                            <li>
                                <label>物料编码：</label>
                                <input type="text" name="productId"/>
                            </li>
<!--                            <li>-->
<!--                                <label>生产日期：</label>-->
<!--                                <input type="text" name="unitName"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>客户：</label>-->
<!--                                <input type="text" name="outId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>物品状态：</label>-->
<!--                                <input type="text" name="price"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>供应商：</label>-->
<!--                                <input type="text" name="entryid"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>数量：</label>-->
<!--                                <input type="text" name="quantity"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>重量：</label>-->
<!--                                <input type="text" name="quantityX"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>包装：</label>-->
<!--                                <input type="text" name="kechaiQuantity"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>MES单据编号：</label>-->
<!--                                <input type="text" name="erpStockoutId"/>-->
<!--                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="search:viewOutHistory:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="search:viewOutHistory:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="search:viewOutHistory:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()"  >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('search:viewOutHistory:edit')}]];
        var removeFlag = [[${@permission.hasPermi('search:viewOutHistory:remove')}]];
        var prefix = ctx + "search/viewOutHistory";
        var outType = [[${@dict.getType('outtype')}]];
        var stockinSource = [[${@dict.getType('stockin_source')}]];
        var warehouseId = [[${@dict.getType('is_house')}]];
        var productStatus = [[${@dict.getType('product_status')}]];


        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "出库单据历史",
                clickToSelect: true,//是否启用点击选中行
                uniqueId:"stockoutDetailId",//表主键(用于修改和删除)
                sortName:"stockoutDetailId",//必加排序 sortOrder: "asc"默认
                columns: [
                    {
                        halign: 'center',
                        align:'center',
                        checkbox: true
                    },
                {
                    title: "序号",
                    halign: 'center',
                    align:'center',
                    width: 55,
                    formatter:function (value, row, index) {
                        //获取每页显示的数量
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;

                    }
                },

                {
                    field: 'stockoutDetailId',
                    title: '子表ID',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'stockoutId',
                    title: '主表ID',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'outType',
                    title: '单据类型',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(outType, value);
                    }
                },
                {
                    field: 'createManId',
                    title: '建单人',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'createDate',
                    title: '创建时间',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockoutSource',
                    title: '单据来源',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(stockinSource, value);
                    }
                },
                {
                    field: 'FID',
                    title: '下发订单号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'carNumber',
                    title: '优先级',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productId',
                    title: '物料编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'unitName',
                    title: '物品名称',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'outId',
                    title: '客户',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'price',
                    title: '物品状态',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(productStatus, value);
                    }
                },
                {
                    field: 'entryid',
                    title: '供应商',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'quantity',
                    title: '数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'quantityX',
                    title: '重量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'kechaiQuantity',
                    title: '包装',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'erpStockoutId',
                    title: 'MES单据编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'warehouseId',
                    title: '仓库',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(warehouseId, value);
                    }
                },
               ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>